#ifndef RANDOM_H
#define RANDOM_H

#include "common.h"

// MT19937 based PRNG, simple implementation
// without all init_by_array nonsense.
class Random
{
public:
	Random();
	Random(uint seed);

	// Linear distribution (ranges are inclusive)
	uint randUInt();
	uint randUInt(uint low, uint high);
	int randInt();
	int randInt(int low , int high);
	float randFloat(float low = 0.0f, float high = 1.0f);
	
	// Normal distribution
	float normal();
	float normal(float mean, float variance);

private:
	void init(uint seed);
	void update_state();

	// Periods
	static const uint n = 624;
	static const uint m = 397;
	
	uint state[n];
	uint index;
};

#endif

